package com.yhq.basic.design.singleton;

import java.io.Serializable;

/**
 * 单例模式
 * 懒汉式-方法加锁
 *
 * @author hqyin
 * @date 2023/2/3 11:00 上午
 */
public class Singleton4 implements Serializable {
    private static Singleton4 INSTANCE = null;

    private Singleton4() {

    }

    public static synchronized Singleton4 getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new Singleton4();
        }
        return INSTANCE;
    }
}
